<template>
  <!--负责系统注册-->
  <div>
    <form @submit.prevent="register">
      生日：<input type="text" v-model="birthday"><br>
      性别:男<input type="radio" value=1 name="sex">
          女<input type="radio" value=2 name="sex"><br>
      昵称：<input type="text" v-model="nickName"><br>
      密码：<input type="password" v-model="password"><br>
      手机号：<input type="text" v-model="phone"><br>
      学校：<input type="text" v-model="school"><br>
      验证码：<input type="text" v-model="uuid">
      <button @click="getUUID">获取验证码</button>
      <button>注册</button>

    </form>

  </div>

</template>

<script>
export default {
  name: "Register",
  data(){
    return{
      birthday:'',
      sex:0,
      nickName:'',
      password:'',
      phone:'',
      school:'',
      uuid:''
    }
  },
  methods:{
    //从服务器获取验证码
    getUUID(){
      this.$http.get('http://localhost:8989/bingo/getCaptcha').then(res=>{console.log(res)}).catch(error=>{console.log(error)})

    },
    //提交注册请求
    register(){
      console.log('register被调用')
      this.$http.post('http://localhost:8989/bingo/register',{
        birthday:this.birthday,
        sex:this.sex,
        nickName:this.nickName,
        password:this.password,
        phone:this.phone,
        school:this.school,
        uuid:this.uuid
      }).then(res=>{
        console.log(res)
      }).catch(error=>{
        console.log(error)
      })


    }
  }


}
</script>

<style scoped>

</style>
